<!-- 附件其他属性 -->

<template>
  <div v-if="secretList.length > 0">
    密级：
    <el-select
      v-model="formData.secret"
      placeholder="请选择"
      style="width: 200px; margin-right: 20px"
      clearable
    >
      <el-option
        v-for="item in secretList"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      ></el-option>
    </el-select>
  </div>
  <div v-if="fileDocClassifyList.length > 0">
    附件用途：
    <el-select
      v-model="formData.fileDocClassify"
      placeholder="请选择"
      @change="handleFileDocClassifyChange"
      style="width: 200px; margin-right: 20px"
      clearable
    >
      <el-option
        v-for="item in fileDocClassifyList"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      ></el-option>
    </el-select>
  </div>
</template>

<script setup>
import { isEmpty } from '@/utils/index.js'
const props = defineProps({
  secretList: {
    type: Array,
    default: () => [],
  },
  fileDocClassifyList: {
    type: Array,
    default: () => [],
  },
})
const formData = defineModel()

//编辑时 用途切换,带入用途名称
const handleFileDocClassifyChange = (val) => {
  if (isEmpty(val)) {
    formData.value.fileDocClassifyName = undefined
  } else {
    const item = props.fileDocClassifyList.find((item) => item.value === val)
    formData.value.fileDocClassifyName = item?.label
  }
}
</script>

<style lang="scss" scoped></style>
